# rFileName  = 'D:/file888.txt'
# wFileName ='D:/file999.txt'
# with open(rFileName) as rfile,open(wFileName,'w')as wfile:
#     newlist=rfile.read().splitlines()
#     print(newlist)
#     for one in newlist:
#         # print(one)
#         namepart,salarypart=one.split(';')
#         name=namepart.split(':')[1].strip()
#         salar=int(salarypart.split(':')[1].strip())
#         incomm=int(salar*0.9)
#         tax=int(salar*0.1)
#
#         outstr = 'name:{:*^10},salar:{:>8},incomm:{:>6},tax:{:>6}'.format(name,salar,incomm,tax)
#
#         print(outstr)
#
#         wfile.write(outstr +'\n')


rfilename='d:/file2.txt'
wfilename='d:/file22.txt'
# fo =open(rfilename)
# fo1 =open(wfilename,'w')

with open(rfilename) as rfile,open(wfilename,'w')as wfile:
    newlist=rfile.read().splitlines()
    for one in newlist:
        # print(one)

        if one.count(';')!=1:
            continue
        namepart,salarypath=one.split(';')
        if namepart.count(':')!=1:
            continue
        if salarypath.count(':')!=1:
            continue
        name =namepart.split(':')[1].strip()
        salary=int(salarypath.split(':')[1].strip())
        incomm=int(salary*0.9)
        tax=int(salary*0.1)
        out='name:{:10},sal:{:6},incomm:{:6},tax:{:6}'.format(name,salary,incomm,tax)
        print(out)

        wfile.write(out +'\n')




















